/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * internalFrame.java
 *
 * Created on 2009-2-17, 15:19:38
 */
package com.web.ui.common.component;

import com.web.ui.UIApp;
import com.web.ui.UIMain;
import java.awt.Color;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import org.jdesktop.application.Application;
import org.jdesktop.jdic.browser.WebBrowser;

/**
 *
 * @author Administrator
 */
public class InternalFrame extends javax.swing.JInternalFrame {
    
    /**
     * 浏览器对象
     *
     * @since PASIAM Ver1.0
     */
    public volatile static WebBrowser webBrowser;

    /**
     * 是否打开堡垒主机系统
     *
     * @since PASIAM Ver1.0
     */
    public static boolean isOpenHost;

    public InternalFrame(final int newSequenceValue, String title) {
        try {
            //创建一个内部窗
            initComponents();
            this.setName("" + newSequenceValue);
            resourceMap = Application.getInstance(UIApp.class).getContext().getResourceMap(UIMain.class);
            // 设置右侧窗口背景          
            this.dataShowScrollPane.getViewport().setBackground(Color.white);

            //设置内部窗口导航树的内容            

        } catch (Exception ex) {
            Logger.getLogger(InternalFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    /** Creates new form internalFrame */
    public InternalFrame() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        splitPane1 = new javax.swing.JSplitPane();
        rightPanel = new javax.swing.JPanel();
        topPanel = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        centerPanel = new javax.swing.JPanel();
        dataShowScrollPane = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();

        setBorder(null);
        setMaximizable(true);
        setAutoscrolls(true);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance().getContext().getResourceMap(InternalFrame.class);
        setFrameIcon(resourceMap.getIcon("Form.frameIcon")); // NOI18N
        setName("Form"); // NOI18N
        try {
            setSelected(true);
        } catch (java.beans.PropertyVetoException e1) {
            e1.printStackTrace();
        }
        setVisible(true);

        splitPane1.setName("splitPane1"); // NOI18N

        rightPanel.setName("rightPanel"); // NOI18N
        rightPanel.setPreferredSize(new java.awt.Dimension(402, 421));
        rightPanel.setLayout(new java.awt.BorderLayout());

        topPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        topPanel.setName("topPanel"); // NOI18N
        topPanel.setLayout(new java.awt.BorderLayout());

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel1.setText(resourceMap.getString("lbLocation.text")); // NOI18N
        jLabel1.setName("lbLocation"); // NOI18N
        topPanel.add(jLabel1, java.awt.BorderLayout.CENTER);

        rightPanel.add(topPanel, java.awt.BorderLayout.PAGE_START);

        centerPanel.setName("centerPanel"); // NOI18N
        centerPanel.setLayout(new java.awt.CardLayout());

        dataShowScrollPane.setName("dataShowScrollPane"); // NOI18N

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        jTable1.setName("jTable1"); // NOI18N
        dataShowScrollPane.setViewportView(jTable1);

        centerPanel.add(dataShowScrollPane, "card2");

        rightPanel.add(centerPanel, java.awt.BorderLayout.CENTER);

        splitPane1.setRightComponent(rightPanel);

        getContentPane().add(splitPane1, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * 刷新菜单项对应的事件响应
     *
     * @param  evt  响应事件
     * @throws IOException设定文件中缺少信息时
     * @author 刘宗威
     * @since  CodingExample　Ver 1.0
     */
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel centerPanel;
    private javax.swing.JScrollPane dataShowScrollPane;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JTable jTable1;
    private javax.swing.JPanel rightPanel;
    private javax.swing.JSplitPane splitPane1;
    private javax.swing.JPanel topPanel;
    // End of variables declaration//GEN-END:variables

    //资源文件
    private org.jdesktop.application.ResourceMap resourceMap;

    public JScrollPane getRightScrollPanel(){
        return dataShowScrollPane;
    }


     public JLabel getJLabel1(){
        return jLabel1;
    }


    public void updateUI(){
        try {
            super.updateUI();
            //  最大化
            if(this.getParent() != null  && this.isSelected()){

                //  去掉标题栏
                if(this.getUI() != null){
                    ((BasicInternalFrameUI)this.getUI()).setNorthPane(null);
                    this.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE);
                }
                //  去掉边框
                this.setBorder(BorderFactory.createEmptyBorder());
                this.setMaximum(true);
            }
        } catch (Throwable e) {
            
        } 
    }
}